<!DOCTYPE html>
<html>
<head>
    <title>Test API Connection</title>
</head>
<body>
    <h1>Testing Agent Workspace API</h1>
    <div id="results"></div>
    
    <script>
        async function testAPI() {
            const results = document.getElementById('results');
            
            try {
                // Test 1: Accounts
                results.innerHTML += '<p>Testing accounts API...</p>';
                const accountsResponse = await fetch('http://localhost:8080/api/v1/accounts', {
                    headers: { 'X-AW-Token': 'testtoken' }
                });
                const accounts = await accountsResponse.json();
                results.innerHTML += '<p>✅ Accounts API: ' + JSON.stringify(accounts) + '</p>';
                
                // Test 2: Feed
                results.innerHTML += '<p>Testing feed API...</p>';
                const feedResponse = await fetch('http://localhost:8080/api/v1/owners/me/feed?limit=3', {
                    headers: { 'X-AW-Token': 'testtoken' }
                });
                const feed = await feedResponse.json();
                results.innerHTML += '<p>✅ Feed API: ' + feed.length + ' events loaded</p>';
                
            } catch (error) {
                results.innerHTML += '<p>❌ Error: ' + error.message + '</p>';
            }
        }
        
        testAPI();
    </script>
</body>
</html>
